{extend name="base" /}
{block name="body"}
<div class="layui-card">
	<div class="layui-card-header">
		<form action="{:url('admin/scholar/resultIndex')}" class="layui-form" method="get">
			<div class="layui-form-item">
				<div class="layui-inline">
					姓名
				</div>
				<div class="layui-inline">
					<input type="text" name="name" value="{:input('name')}" autocomplete="off" class="layui-input"/>
				</div>
				<div class="layui-inline">
					机构
				</div>
				<div class="layui-inline">
					<select name="institute">
						<option value="">全部机构</option>
						{foreach name="institute" item="v"}
						<option value="{$v.institute}" {if condition="input('institute') eq $v.institute" }selected="selected"{/if}>{$v.institute}</option>
						{/foreach}
					</select>
				</div>
				<div class="layui-inline">
					职称
				</div>
				<div class="layui-inline">
					<select name="professional_title">
						<option value="">全部职称</option>
						{foreach name="professionalTitle" item="v"}
						<option value="{$v.professional_title}" {if condition="input('professional_title') eq $v.professional_title" }selected="selected"{/if}>{$v.professional_title}</option>
						{/foreach}
					</select>
				</div>
				<div class="layui-inline">
					<button class="layui-btn layui-btn-normal ajax-search"><i class="fa fa-search"></i></button>
				</div>
			</div>
		</form>
	</div>
	<div class="layui-card-body">
        <div class="layui-btn-group">
        </div>
		<table class="layui-table layui-form">
			<thead>
			<tr>
				<th>姓名</th>
				<th>机构</th>
				<th>中文论文</th>
				<th>SCI</th>
				<th>EI</th>
				<th>专利</th>
				<th>其他</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{foreach name="list" item="v" empty="$empty"}
			<tr>
				<td>{$v.scholar_name}</td>
				<td>{$v.institute}</td>
				<td>
					{if $v.paper_num > 0}<a onclick="viewDetailByCode({$v.id}, 'J')" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> {$v.paper_num}</a>
					{else $v.paper_num == 0}{$v.paper_num}
					{/if}
				</td>
				<td>
					{if $v.sci_num > 0}<a onclick="viewDetailByCode({$v.id}, 'I')" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> {$v.sci_num}</a>
					{else $v.sci_num == 0}{$v.sci_num}
					{/if}
				</td>
				<td>
					{if $v.ei_num > 0}<a onclick="viewDetailByCode({$v.id}, 'E')" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> {$v.ei_num}</a>
					{else $v.ei_num == 0}{$v.ei_num}
					{/if}
				</td>
				<td>
					{if $v.patent_num > 0}<a onclick="viewDetailByCode({$v.id}, 'U')" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> {$v.patent_num}</a>
					{else $v.patent_num == 0}{$v.patent_num}
					{/if}
				</td>
				<td>
					{if $v.other_num > 0}<a onclick="viewDetailByCode({$v.id}, 'other')" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> {$v.other_num}</a>
					{else $v.other_num == 0}{$v.other_num}
					{/if}
				</td>
				<td>
					<a onclick="viewDetail({$v.id})" class="layui-btn layui-btn-xs layui-btn-normal"><i class="fa fa-edit"></i> 详情</a>
				</td>
			</tr>
			{/foreach}
			</tbody>
		</table>
		<div class="page">{$list->render()}</div>
	</div>
</div>
{/block}
{block name="js"}
<script>
	function viewDetail(data) {
		if (data === '' || data === null || data === undefined) {
			layer.msg("该学者暂无履历");
			return
		}
		//自定页
		layer.open({
			type: 2,
			title: '成果详情',
			shadeClose: true,
			shade: false,
			area: ['90%', '90%'],
			content: '/admin/scholar/resultDetail?scholarId=' + data,
		});
	}

	function viewDetailByCode(data, resourceCode) {
		if (data === '' || data === null || data === undefined) {
			layer.msg("该学者暂无履历");
			return
		}
		//自定页
		layer.open({
			type: 2,
			title: '成果详情',
			shadeClose: true,
			shade: false,
			area: ['90%', '90%'],
			content: '/admin/scholar/resultDetail?scholarId=' + data + '&resourceCode=' + resourceCode,
		});
	}
</script>
{/block}